Monotonic Counters: A New Mechanism for Thread Synchronization

نویسندگان

  • John Thornley
  • K. Mani Chandy
چکیده

Only a handful of fundamental mechanisms for synchronizing the access of concurrent threads to shared memory are widely implemented and used. These include locks, condition variables, semaphores, barriers, and monitors. In this paper, we introduce a new synchronization mechanism—monotonic counters—and make a case for its addition to this group. Unlike most other synchronization mechanisms, monotonic counters were designed primarily for multiprocessing, rather than for systems programming. Counters have a very simple definition: a counter object has a nonnegative value, an Increment operation, and a Check operation. Increment atomically increases the counter, and Check suspends until the counter reaches a specified level. We demonstrate that many practical thread synchronization patterns can be expressed more elegantly using counters then with other synchronization mechanisms. Of particular importance, the monotonicity of counters can be used to guarantee deterministic synchronization and the equivalence of multithreaded and sequential execution. In terms of implementation, counters are distinguished from traditional synchronization mechanisms, in that they have a dynamically varying number of thread suspension queues. We give several examples of multithreaded programs that use counter synchronization, and give an implementation of counters on top of locks and condition variables.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An enhanced thread synchronization mechanism for Java

class Condition { protected EMonitor AssociatedEMonitor; public Condition(Object object) throws IllegalArgumentException{ if(object instanceof EMonitor) AssociatedEMonitor = (EMonitor) object; else if(object instanceof EMonitoredInterface) AssociatedEMonitor = ((EMonitoredInterface) object).GetEMonitor(); else throw new IllegalArgumentException(); }

متن کامل

Reducing Misspeculation Penalty in Trace-Level Speculative Multithreaded Architectures

Trace-Level Speculative Multithreaded Processors exploit trace-level speculation by means of two threads working cooperatively. One thread, called the speculative thread, executes instructions ahead of the other by speculating on the result of several traces. The other thread executes speculated traces and verifies the speculation made by the first thread. Speculated traces are validated by ver...

متن کامل

Supporting Fine-Grained Synchronization on a Simultaneous Multithreading Processor

Existing multiprocessor synchronization mechanisms are relatively heavyweight, due in part to the level of the memory hierarchy (typically main memory) at which threads must synchronize. Multithreaded processors, on the other hand, have the potential to significantly reduce synchronization cost, because threads share the processor simultaneously and can synchronize using processor-internal stat...

متن کامل

An Implementation of a Hop eld Network

EARTH is a multithreaded program execution and architecture model that hides communication and synchronization latencies through ne-grain multithreading. EARTH provides a simple synchronization mechanism: a thread is spawned when a pre-speciied number of synchronization signals are received in its synchronization slot { signaling the fact that all dependences required for its execution are sati...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2000